In this question we can use the king rule
…(1)
…(2)
On adding eq(1) and eq(2)
Let, cos x = t
Differentiating both side with respect to x
⇒ -dt = sin x dx
At x = 0, t = 1
At x = π, t = -1